﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LeastMajorityNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = new int[5];
            input[0] = int.Parse(Console.ReadLine());
            input[1] = int.Parse(Console.ReadLine());
            input[2] = int.Parse(Console.ReadLine());
            input[3] = int.Parse(Console.ReadLine());
            input[4] = int.Parse(Console.ReadLine());
            Array.Sort(input);
            int leastMajorityNumber = input[2] - 1; ;
            int dividersCount = 0;
            while (dividersCount < 3)
            {
                leastMajorityNumber++;
                dividersCount = 0;
                for (int i = 0; i < 5; i++)
                {
                    dividersCount += leastMajorityNumber % input[i] == 0 ? 1 : 0;
                }
            }
            Console.WriteLine(leastMajorityNumber);
        }
    }
}
